<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>promise 练习</title>
</head>
<body>
<script>

  // 先来个最直接的
  const p = function() {
    return new Promise((res, rej) => {
      setTimeout(() => res(10), 2000)
    })
  }
  // p().then(t => t + 1).then(t => console.log(t))


  // 异步函数
  const run = async function() {
    let cp = await p() + 10

    console.log(cp);
  }
  run()

</script>